const { DataTypes } = require("sequelize");
const seq = require("../db/seq");

//创建模型类
const User = seq.define("User", {
  userEmail: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: "用户邮箱,唯一",
  },
  password: {
    type: DataTypes.CHAR(64),
    allowNull: false,
    comment: "密码",
  },
  userName: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: "用户昵称",
  },
  isAdmin: {
    type: DataTypes.NUMBER,
    allowNull: false,
    defaultValue: 0,
    comment: "是否为管理员 0不是 1是",
  },
});

// User.sync({ force: true })

module.exports = User;
